﻿using WQLWebAPI.Domain.Abstract;
using WQLWebAPI.Domain.Entities;
using WQLWebAPI.Infrastructure.CommonDtos;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using WQLWebAPI.Infrastructure.Extensions;

namespace WQLWebAPI.Application.Loggers
{
    public class LogService : ILogService
    {
        private IBaseRepository<ErrorLog> _errorLogRepository;
        private IBaseRepository<InfoLog> _infoLogRepository;
        public LogService(IBaseRepository<ErrorLog> errorLogRepository, IBaseRepository<InfoLog> infoLogRepository)
        {
            _errorLogRepository = errorLogRepository;
            _infoLogRepository = infoLogRepository;
        }
        public async Task<Pagelist<ErrorLog>> GetErrorLogerAsync(PageInputDto pageInput)
        {
            var result =await  _errorLogRepository.GetAll().PageByAsync(pageInput,p=>p.Id);
            return result;
        }


        public async Task<Pagelist<InfoLog>> GetInfoLogerAsync(PageInputDto pageInput)
        {
            var result = await _infoLogRepository.GetAll().PageByAsync(pageInput, p => p.Id);
            return result;
        }
    }
}
